package com.example.crm.controller;

import com.example.crm.entity.User;
import com.example.crm.service.IUserService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import javax.annotation.Resource;

/**
 * @author lenovo
 */
@Controller
public class ExampleController {
    @Resource
    private IUserService userService;

    @GetMapping("/hello/{id}")
    public String getUser(@PathVariable("id") Long usrId, Model model){
        User user = userService.getUser(usrId);
        model.addAttribute("user",user);
        return "demo/hello";
    }
}
